package com.zhoushihao.class0821;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;
import java.util.Scanner;

public class PrintCalendar {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String date = sc.nextLine();
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        LocalDate localDate = LocalDate.parse(date, formatter);
        LocalDate firstDay = localDate.with(TemporalAdjusters.firstDayOfMonth());
        LocalDate lastDay = localDate.with(TemporalAdjusters.lastDayOfMonth());
        int monthDays = lastDay.getDayOfMonth();
        String[] weekdays = {"一", "二", "三", "四", "五", "六", "日"};
        for (String weekday : weekdays) {
            System.out.print(weekday + "\t");
        }
        System.out.println();
        for (int i = 0; i < monthDays; i++) {
            LocalDate nextDay = firstDay.plusDays(i);
            int dayOfWeek = nextDay.getDayOfWeek().getValue();
            if (nextDay.equals(firstDay)) {
                int headTab = dayOfWeek - 1;
                while (headTab-- > 0) {
                    System.out.print("\t");
                }
            }
            if(nextDay.equals(localDate)) {
                System.out.print("*");
            }
            System.out.print(nextDay.getDayOfMonth() + "\t");
            if (dayOfWeek == 7) {
                System.out.println();
            }
        }
    }
}
